<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 * @author   howe <howe1995@163.com>
 */

namespace App\Helper;

/**
 * Json 字符串助手.
 */
class JsonHelper
{
    /**
     * Json 字符串解析.
     *
     * @param mixed $value
     * @return mixed
     */
    public static function decode($value)
    {
        return json_decode($value, true);
    }

    /**
     * Json 加密.
     *
     * @param mixed $value
     * @return false|string
     */
    public static function encode($value)
    {
        return json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    }
}
